"""补天士平台相关操作封装"""
import json

import requests

from groot2.cloud.base.http_request.debugger import http_debug

from lib.global_share import GlobalShare


def machine_info_report(env_name: str):
    """机器信息上报"""

    url = f"https://jtl.jidu{env_name}.com/api/peqacenter-tools/pressure/machine_info/upload"
    headers = {"Content-Type": "application/json"}
    data = [
        {
            "agent_server_ip": f"{GlobalShare.AGENT_IP}",
            "agent_server_port": GlobalShare.AGENT_PORT,
        },
    ]
    _response = requests.get(url, headers=headers, data=json.dumps(data), timeout=3)
    http_debug(url=url, headers=headers, data=data, ret=_response.text)
